<form action="/scene/commentReplyAdd" method="post" id="commentForm">
    <input type="hidden" name="SceneCommentId" id="SceneCommentId" value="">
    <input type="hidden" name="usernameOld" id="usernameOld" value="">
    <input type="hidden" name="type" value="0" id="commentType">
    <input type="hidden" name="refComment.id" id="refCommentId">

<div class="rev-list">
    <ul>
<#list pageInfo.list as u>
    <li class="rev-item comment-item clearfix">
        <div class="user"><a class="avatar" href="#" target="_blank"><img
                src="${(u.user.headImgUrl)!}"
                width="48" height="48"></a><span class="level">LV.${(u.user.level)!}</span></div>
        <a class="useful" data-id="191407415" title="点赞">
            <i></i><span class="useful-num">${(u.thumbupNum)!}</span>
        </a>
        <a class="name" href="/u/52068941.html" target="_blank">${u.user.nickname} </a>
        <span class="s-star s-star${u.starNum}"></span>
        <p class="rev-txt">${u.contents}
        </p>
        <div class="rev-img">
            <a href="/photo/poi/25091_440424016.html" target="_blank"><img
                    src="${u.images}"
                    width="200" height="120"></a>
        </div>

        <div class="info clearfix">
            <a class="btn-comment _j_comment" title="添加评论">评论</a>
            <span class="time">${u.createTime?string("yyyy-MM-dd HH:mm:ss")}</span>
            <span class="from">
                                此条点评来自游记<a href="/i/12601474.html" target="_blank">《南国花城正月中 ——2019年春节广州记（含长...》</a>
                            </span>
        </div>

        <div class="comment add-reply ">
            <ul class="more_reply_box comment_list">
               <#if u.sceneCommentReplies??>
                   <#list u.sceneCommentReplies as s>
                       <#if s.type == 0>
                       <li>
                           <a href="#" target="_blank">
                               <img src="${s.headUrl}"
                                    width="16" height="16">${s.username}
                           </a>
                           ：${s.commentContent}
                           <a class="_j_reply re_reply" data-id="${u.id}" data-uid="${s.id}"
                              data-username="${s.username}" data-user="${userInfo!}" title="添加回复">回复</a>
                           <br><span class="time">${(s.createTime)?string("yyyy-MM-dd HH:mm:ss")}</span>
                       </li>
                       <#else >
                        <li>
                            <a href="#" target="_blank">
                                <img src="${s.headUrl}" width="16" height="16">${s.username}
                            </a>
                            回复${s.refComment.username}：${s.commentContent}
                            <a class="_j_reply re_reply" data-id="${u.id}" data-uid="${s.id}"
                               data-username="${s.username}" data-user="${userInfo!}" title="添加回复">回复</a>
                            <br><span class="time">${(s.createTime)?string("yyyy-MM-dd HH:mm:ss")}</span>
                        </li>
                       </#if>
                   </#list>
               </#if>
                <ul class="more_reply_box comment_list">


                </ul>
            </ul>
        </div>
        <div class="add-comment hide reply-form">
            <textarea class="comment_reply"  name="commentContent" id="commentContent" placeholder="" style="overflow: hidden; color: rgb(204, 204, 204);"></textarea>
            <a class="btn btn_submit_reply" data-commentid="${u.id}" data-usernameid="${u.user.nickname}">回复</a>
        </div>
    </li>
</#list>
    </ul>

</div>
</form>
<script>

$(function () {



    //回复
    $(".re_reply").on("click", function () {

        var userIfo = $(this).data("user");
        if (!userIfo) {
            popup("请先登录"); //
            return;
        }

        var username = $(this).data("username");
        console.log(username);
        var toid = $(this).data("uid");

        $("#commentContent").focus();
        $("#commentContent").attr("placeholder", "回复：" + username);

        $("#commentType").val(1);
        $("#refCommentId").val(toid);
        $("#usernameOld").val(username);
    });

    //发表回复
    $(".btn_submit_reply").click(function () {


        var commentid = $(this).data("commentid");
        console.log(commentid);
        $("#SceneCommentId").val(commentid);

        var usernameid = $(this).data("usernameid");
        console.log(usernameOld);
        $("#usernameOld").val(usernameid);


        if (!$("#commentContent").val()) {
            alert("评论不能为空");
            return;
        }

        $("#commentForm").ajaxSubmit(function (data) {

            $("#commentContent").val("");

            $("#commentContent").attr("placeholder", "");

            // $(".comment_list").append(data);
            window.location.reload()

        })
    });
})
</script>


